import {ref} from "vue";

export let unFinishedLayout = ref(true)
export const layouts = {
    force: {
        animate: true,
        type: 'force',
        linkDistance: 110,
        nodeStrength: 0,
        edgeStrength: 0,
        collideStrength: 0.8,
        preventOverlap: true,
        nodeSpacing: 42,
        nodeSize: 32,
        alpha: 0.35,
        alphaDecay: 0.03,
        alphaMin: 0.01,
        forceSimulation: null,
        clusterLayouts: {
            clustering: true,
            clusterNodeStrength: -8,
            clusterEdgeDistance: 210,
            clusterNodeSize: 50,
            clusterFociStrength: 1.1,
        },
        onLayoutEnd: function () {
            setTimeout(() => {
                unFinishedLayout.value = false
            }, 100)
        }
    },
    force2: {
        type: "force2",
        animate: true,
        linkDistance: 150,
        nodeStrength: 1550,
        edgeStrength: 80,
        preventOverlap: true,
        nodeSpacing: 50,
        minMovement: 0.85,
        distanceThresholdMode: "mean",
        maxIteration: 1600,
        damping: 0.25,
        interval: 0.02,
        maxSpeed: 1200,
        factor: 2,
        coulombDisScale: 0.01,
        gravity: 5,
        centripetalOptions: {
            single: (node, nodes, edges) => 2,
            leaf: (node, nodes, edges) => 2,
            others: (node, nodes, edges) => 1,
        },
        clusterLayouts: {
            clustering: true,
            leafCluster: true,
            nodeClusterBy: null,
            clusterNodeStrength: 30,
        },
        onLayoutEnd: function () {
            setTimeout(() => {
                unFinishedLayout.value = false
            }, 100)
        }
    },
    gForce: {
        type: "gForce",
        linkDistance: 1,
        nodeStrength: 1000,
        edgeStrength: 240,
        nodeSpacing: 50,
        preventOverlap: true,
        minMovement: 0.6,
        maxIteration: 1000,
        damping: 0.9,
        maxSpeed: 1000,
        coulombDisScale: 0.008,
        gravity: 20,
        gpuEnabled: true,
        workerEnabled: false,
        onLayoutEnd: function () {
            setTimeout(() => {
                unFinishedLayout.value = false
            }, 100)
        }
    },
    forceAtlas2: {
        type: 'forceAtlas2',
        kr: 20,
        kg: 3,
        maxIteration: 100,
        ks: 0.15,
        tao: 0.12,
        preventOverlap: true,
        dissuadeHubs: false,
        preset: 'random',
        workerEnabled: false,
        onLayoutEnd: function () {
            setTimeout(() => {
                unFinishedLayout.value = false
            }, 100)
        }
    },

    circular: {
        type: 'circular',
        radius: null,
        startRadius: 0,
        endRadius: 100,
        clockwise: true,
        divisions: 1,
        ordering: 'degree',
        angleRatio: 1,
        workerEnabled: false,
        onLayoutEnd: function () {
            setTimeout(() => {
                unFinishedLayout.value = false
            }, 100)
        }
    }
}
export const clusterLayouts = {
    clustering: true,
    clusterNodeStrength: -8,
    clusterEdgeDistance: 210,
    clusterNodeSize: 40,
    clusterFociStrength: 1.1,
}
